package com.wenjie.original.flex_config;

import com.mybatisflex.core.FlexGlobalConfig;
import com.mybatisflex.core.logicdelete.LogicDeleteProcessor;
import com.mybatisflex.core.logicdelete.impl.TimeStampLogicDeleteProcessor;
import com.mybatisflex.spring.boot.MyBatisFlexCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author wenjie
 * @Description 对mybatis-flex进行全局处理 https://mybatis-flex.com/zh/base/mybatis-flex-customizer.html#mybatisflexcustomizer
 * @date 2024/5/22 14:55
 */
@Configuration
public class MyBatisFlexConfiguration implements MyBatisFlexCustomizer {


    /**
     * @Description 这个地方是使用的全局参数
     * @author wenjie
     * @date 2024/5/22 14:41
     */
    @Override
    public void customize(FlexGlobalConfig globalConfig) {

    }

    /**
     * @Description 将逻辑删除设置为 删除后的填充是 时间戳    https://mybatis-flex.com/zh/core/logic-delete.html#%E5%86%85%E7%BD%AE%E9%80%BB%E8%BE%91%E5%88%A0%E9%99%A4%E5%A4%84%E7%90%86%E5%99%A8
     * @author wenjie
     * @date 2024/5/22 14:44
     */
    @Bean
    public LogicDeleteProcessor logicDeleteProcessor() {
        return new TimeStampLogicDeleteProcessor();
    }


}
